
.global _start

_start:
    /*
     * 使能所有外设时钟
     */
    ldr r0, =0x020c4068 @ CCGR0
    ldr r1, =0xffffffff @ 要向CCGR0写入的数据
    str r1, [r0]        @ 将r1的值写入到r0指向的地址

    ldr r0, =0x020c406c @ CCGR1
    str r1, [r0]

    ldr r0, =0x020c4070 @ CCGR2
    str r1, [r0]

    ldr r0, =0x020c4074 @ CCGR3
    str r1, [r0]

    ldr r0, =0x020c4078 @ CCGR4
    str r1, [r0]

    ldr r0, =0x020c407c @ CCGR5
    str r1, [r0]

    ldr r0, =0x020c4080 @ CCGR6
    str r1, [r0]

    /*
     * 配置IO复用 GPIO1_IO03的复用为GPIO 
     * IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 = 5
     * addr: 0x020e0068
     */
    ldr r0, =0x020e0068 @ IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03
    ldr r1, =0x5        @ 要向CCGR0写入的数据
    str r1, [r0]        @ 将r1的值写入到r0指向的地址
    
    /*
     * 配置GPIO1_IO03的电气属性
     * IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03
     * addr: 0x020e02f4
     *
     * bit0:     0 低速率
     * bit5-3:   110 R0/6驱动能力
     * bit7-6:   10 100MHz速度
     * bit11:    0 关闭开路输出
     * bit12:    1 使能pull/kepper
     * bit13:    0 kepper
     * bit15-14: 00 100k下拉
     * bit16:    0 关闭hys
     * 0,0001,0000,1011,0000 => 0x10b0
     */
    ldr r0, =0x020e02f4
    ldr r1, =0x10b0
    str r1, [r0]

    /*
     * 设置GPIO
     * GPIO_GDIR
     * addr: 0x0209c004
     * bit3: 1
     * 1000 => 0x8
     */
    ldr r0, =0x0209c004
    ldr r1, =0x8
    str r1, [r0]

    /*
     * 打开LED GPIO1_IO03设置0
     * GPIO1_DR
     * addr: 0x0209c000
     */
    ldr r0, =0x0209c000
    ldr r1, =0
    str r1, [r0]

loop:
    b loop

